//
//  VoiceBroadcastSettingsView.m
//  CoachsBook
//
//  Created by MaBookPro on 2022/8/25.
//

#import "VoiceBroadcastSettingsView.h"

@implementation VoiceBroadcastSettingsView


- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        
        [self CreateUI];
    }
    return self;
}
-(void)CreateUI{

    UIView *backV = [[UIView alloc]initWithFrame:CGRectMake(0, 0, APPwidth, 280)];
    backV.backgroundColor = [UIColor whiteColor];
    [self addSubview:backV];
    
    UIView *titleLine = [[UIView alloc]initWithFrame:CGRectMake(15, 15, 3, 15)];
    titleLine.backgroundColor = rgba(22, 120, 255, 1);
    titleLine.layer.cornerRadius = 2;
    [backV addSubview:titleLine];
    UILabel *titleLab = [[UILabel alloc]initWithFrame:CGRectMake(titleLine.frame.size.width+titleLine.frame.origin.x+5,15, 70, 15)];
    titleLab.text = @"播报设置";
    titleLab.textColor = [UIColor blackColor];
    titleLab.textAlignment = 0;
    titleLab.font = [UIFont systemFontOfSize:16 weight:bold];
    [backV addSubview:titleLab];

    
    
    NSArray *pingpanLabarr = @[@"扣分时播报语音",@"循环播放",@"播报提示音",@"语速/男女声"];
    for (int i = 0; i < pingpanLabarr.count; i++) {
        
        UILabel *typeLab = [[UILabel alloc]initWithFrame:CGRectMake(15,  titleLab.frame.size.height + titleLab.frame.origin.y+15+i*45, APPwidth-30, 45)];
        typeLab.text = pingpanLabarr[i];
        typeLab.textColor = rgba(51, 51, 51, 1);
        typeLab.textAlignment = 0;
        typeLab.userInteractionEnabled = YES;
        typeLab.font = [UIFont systemFontOfSize:14];
        [backV addSubview:typeLab];
        
        
        if (i == 0) {
            UISwitch *kfswich = [[UISwitch alloc]initWithFrame:CGRectMake(typeLab.width-60, 10, 40, 25)];
            [kfswich setOnTintColor: rgba(22, 120, 255, 1)];
            kfswich.on = YES;
            kfswich.transform = CGAffineTransformMakeScale(0.6, 0.);
            [typeLab addSubview:kfswich];
            
            
            UIImageView *lineimg = [[UIImageView alloc]initWithFrame:CGRectMake(0, typeLab.height-1, typeLab.width, 1)];
            lineimg.image = [UIImage imageNamed:@"xuxian"];
            [typeLab addSubview:lineimg];
        }else if (i == 1){
            UISwitch *swich = [[UISwitch alloc]initWithFrame:CGRectMake(typeLab.width-60, 10, 40, 25)];
            [swich setOnTintColor: rgba(22, 120, 255, 1)];
            swich.on = NO;
            swich.transform = CGAffineTransformMakeScale(0.6, 0.);
            [typeLab addSubview:swich];
            
            UIView *line = [[UIView alloc]initWithFrame:CGRectMake(0, 0, typeLab.width-30, 1)];
            line.backgroundColor = rgba(245, 245, 250, 1);
            [typeLab addSubview:line];
        }else if(i == 2){
            
            typeLab.frame = CGRectMake(typeLab.x, typeLab.y, typeLab.width, typeLab.height*2);
            
            UILabel *disLab = [[UILabel alloc]initWithFrame:CGRectMake(0,  typeLab.frame.size.height/2+10, typeLab.width-60, 20)];
            disLab.text = @"(打开播报提示音，每个项目语音结束后添加提示音)";
            disLab.textColor = rgba(153, 153, 153, 1);
            disLab.textAlignment = 0;
            disLab.font = [UIFont systemFontOfSize:13];
            [typeLab addSubview:disLab];
            
            UIButton *bbBtn = [[UIButton alloc]initWithFrame:CGRectMake(typeLab.width-40, typeLab.height/2, 20, 20)];
            [bbBtn setImage:[UIImage imageNamed:@"arrowl"] forState:0];
            [typeLab addSubview:bbBtn];
            
            UIView *line = [[UIView alloc]initWithFrame:CGRectMake(0, 0, typeLab.width-30, 1)];
            line.backgroundColor = rgba(245, 245, 250, 1);
            [typeLab addSubview:line];
        }else{
            typeLab.frame = CGRectMake(typeLab.x, typeLab.y+typeLab.height, typeLab.width, typeLab.height);
            
            UILabel *disLab = [[UILabel alloc]initWithFrame:CGRectMake(typeLab.width/2,  10, typeLab.width-100, 20)];
            disLab.text = @"女声，260字/分钟";
            disLab.textColor = rgba(153, 153, 153, 1);
            disLab.textAlignment = 0;
            disLab.font = [UIFont systemFontOfSize:13];
            [typeLab addSubview:disLab];
            
            UIButton *ysBtn = [[UIButton alloc]initWithFrame:CGRectMake( typeLab.width-40,10, 20, 20)];
            [ysBtn setImage:[UIImage imageNamed:@"arrowl"] forState:0];
            [typeLab addSubview:ysBtn];
        }
    }
    
    UIView *middleline = [[UIView alloc]initWithFrame:CGRectMake(0, backV.height-10,APPwidth, 10)];
    middleline.backgroundColor = rgba(245, 245, 250, 1);
    [backV addSubview:middleline];
    //语音内容设置
    UIView *yybackV = [[UIView alloc]initWithFrame:CGRectMake(0, backV.height+backV.y, APPwidth, 140)];
    yybackV.backgroundColor = [UIColor whiteColor];
    [self addSubview:yybackV];
    UIView *voiceLine = [[UIView alloc]initWithFrame:CGRectMake(15, 15, 3, 15)];
    voiceLine.backgroundColor = rgba(22, 120, 255, 1);
    voiceLine.layer.cornerRadius = 2;
    [yybackV addSubview:voiceLine];
    UILabel *voiceLab = [[UILabel alloc]initWithFrame:CGRectMake(voiceLine.frame.size.width+voiceLine.frame.origin.x+5,15, 100, 15)];
    voiceLab.text = @"语音内容设置";
    voiceLab.textColor = [UIColor blackColor];
    voiceLab.textAlignment = 0;
    voiceLab.font = [UIFont systemFontOfSize:16 weight:bold];
    [yybackV addSubview:voiceLab];

    NSArray *voiceArr = @[@"科二内容设置",@"科三内容设置"];
    for (int j = 0; j < voiceArr.count; j++) {

        UIButton *bmBtn = [[UIButton alloc]initWithFrame:CGRectMake(15, voiceLab.height+voiceLab.y+10+j*45, APPwidth-30, 45)];
        [bmBtn setTitle:voiceArr[j] forState:0];
        bmBtn.contentHorizontalAlignment = 1;
        [bmBtn setTitleColor:rgba(51, 51, 51, 1) forState:0];
//        bmBtn.titleEdgeInsets = UIEdgeInsetsMake(0, 15, 0, 0);
        bmBtn.titleLabel.font = [UIFont systemFontOfSize:14];
        [yybackV addSubview:bmBtn];

        UIView *line = [[UIView alloc]initWithFrame:CGRectMake(0, bmBtn.height-1, bmBtn.width, 1)];
        line.backgroundColor = rgba(245, 245, 250, 1);
        [bmBtn addSubview:line];

        UIImageView *arrowlimg = [[UIImageView alloc]initWithFrame:CGRectMake(bmBtn.frame.size.width-40, 15, 20, 20)];
        arrowlimg.image = [UIImage imageNamed:@"arrowl"];
        arrowlimg.userInteractionEnabled = YES;
        [bmBtn addSubview:arrowlimg];
    }
    UIView *YYline = [[UIView alloc]initWithFrame:CGRectMake(0, yybackV.height-10, APPwidth, 10)];
    YYline.backgroundColor = rgba(245, 245, 250, 1);
    [yybackV addSubview:YYline];



// 灯光语音设置
    UIView *dgbackV = [[UIView alloc]initWithFrame:CGRectMake(0, yybackV.height+yybackV.y, APPwidth, 150)];
    dgbackV.backgroundColor = [UIColor whiteColor];
    [self addSubview:dgbackV];
    UIView *lightLine = [[UIView alloc]initWithFrame:CGRectMake(15, 15, 3, 15)];
    lightLine.backgroundColor = rgba(22, 120, 255, 1);
    lightLine.layer.cornerRadius = 2;
    [dgbackV addSubview:lightLine];
    UILabel *lightLab = [[UILabel alloc]initWithFrame:CGRectMake(lightLine.frame.size.width+lightLine.frame.origin.x+5,15, 120, 15)];
    lightLab.text = @"灯光语音设置";
    lightLab.textColor = [UIColor blackColor];
    lightLab.textAlignment = 0;
    lightLab.font = [UIFont systemFontOfSize:16 weight:bold];
    [dgbackV addSubview:lightLab];


    NSArray *lightArr = @[@"按组随机播放",@"按指令随机播报"];
    NSArray *lightdiisArr = @[@"(从灯光语音组合指令中随机抽取1组播报)",@"(从灯光语音单项指令中随机播放5条)"];
    for (int k = 0; k < lightArr.count; k++) {

        UIButton *lightBtn = [[UIButton alloc]initWithFrame:CGRectMake(15, voiceLab.height+voiceLab.y+10+k*50, APPwidth-30, 50)];
        [lightBtn setTitle:lightArr[k] forState:0];
        lightBtn.contentHorizontalAlignment = 1;
        [lightBtn setTitleColor:rgba(51, 51, 51, 1) forState:0];
        lightBtn.titleEdgeInsets = UIEdgeInsetsMake(0, 0, 15, 0);
        lightBtn.titleLabel.font = [UIFont systemFontOfSize:14];
        [dgbackV addSubview:lightBtn];

        UILabel *disLab = [[UILabel alloc]initWithFrame:CGRectMake(0, 25, lightBtn.width-120, 20)];
        disLab.text = lightdiisArr[k];
        disLab.textColor = rgba(138, 138, 138, 1);
        disLab.textAlignment = 0;
        disLab.font = [UIFont systemFontOfSize:13];
        [lightBtn addSubview:disLab];


        UIView *line = [[UIView alloc]initWithFrame:CGRectMake(0, lightBtn.height-1, lightBtn.width, 1)];
        line.backgroundColor = rgba(245, 245, 250, 1);
        [lightBtn addSubview:line];


        UIImageView *arrowlimg = [[UIImageView alloc]initWithFrame:CGRectMake(lightBtn.frame.size.width-40, 15, 20, 20)];
        arrowlimg.image = [UIImage imageNamed:@"arrowl"];
        arrowlimg.userInteractionEnabled = YES;
        [lightBtn addSubview:arrowlimg];
    }

    
}
@end
